﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using CRM.BLL;
using CRM.Entity;

namespace CRM.Web.AvayaICSoftPhone
{
    public partial class SoftPhoneToolbar : Common.PageBase
    {        

        protected override void OnInit(EventArgs e)
        {
            base.VerificationRight = false;
            base.OnInit(e);
            UserLoginInfo.CheckLoginInfo(); 
            _userLoginInfo = UserLoginInfo.GetLoginInfo();
            btnJianTing.Visible = UserLoginInfo.IsHasPermissionRight("SoftPhoneJianTing");
            btnJianTing.Src = base.ResourcesPath + btnJianTing.Src;

            btnJianTingDisable.Visible = UserLoginInfo.IsHasPermissionRight("SoftPhoneJianTing");
            btnJianTingDisable.Src = base.ResourcesPath + btnJianTingDisable.Src;

            btnQiangCai.Visible = UserLoginInfo.IsHasPermissionRight("SoftPhoneQiangCai");
            btnQiangCai.Src = base.ResourcesPath + btnQiangCai.Src;

            btnQiangCaiDisable.Visible = UserLoginInfo.IsHasPermissionRight("SoftPhoneQiangCai");
            btnQiangCaiDisable.Src = base.ResourcesPath + btnQiangCaiDisable.Src;

            btnQiangCha.Visible = UserLoginInfo.IsHasPermissionRight("SoftPhoneQiangCha");
            btnQiangCha.Src = base.ResourcesPath + btnQiangCha.Src;

            btnQiangChaDisable.Visible = UserLoginInfo.IsHasPermissionRight("SoftPhoneQiangCha");
            btnQiangChaDisable.Src = base.ResourcesPath + btnQiangChaDisable.Src;



        }

        protected void Page_Load(object sender, EventArgs e)
        {
            if (!IsPostBack)
            {
                pageInit();
            }
        }


        
        private void pageInit()
        {
            txtUrl.Text = configBll.GetCacheValueByName(this.Page, "AvayaICServerUrl");
            txtUserExt.Text = _userLoginInfo.UserEntity.EXT;
            txtUserID.Text = _userLoginInfo.UserEntity.USERID.ToString();
            txtUserPWD.Text = configBll.GetCacheValueByName(this.Page, "AgentPassword");
            txtSeatID.Text = _userLoginInfo.UserEntity.SEATID;
            txtOutCode.Text = configBll.GetCacheValueByName(this.Page, "OutCode");
            txtBusinessDivisionCode.Text = _userLoginInfo.UserEntity.BUSINESSDIVISIONCODE;
            txtBusinessDivisionName.Text = _userLoginInfo.UserEntity.BUSINESSDIVISIONNAME;
            txtUserName.Text = _userLoginInfo.UserEntity.USERNAME;
            txtLoginName.Text = _userLoginInfo.UserEntity.LOGINNAME;

            lblExt.Text = _userLoginInfo.UserEntity.EXT;
            lblTSRName.Text = _userLoginInfo.UserEntity.USERNAME;
            lblLoginTime.Text = DateTime.Now.ToString("HH:mm:ss");
        }
    }
}
